package com.web.productservice.controller;

import com.web.productservice.entity.Product;
import com.web.productservice.service.ProductService;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品控制器
 */
@RestController
public class ProductController {

    @Resource
    private ProductService productService;

    @RequestMapping("/product/{id}")
    public ResponseEntity<Product> findProductById(@PathVariable Integer id) {

        Product product = productService.getById(id);
        return ResponseEntity.ok(product);
    }
}
